home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / internet / net commander 1.0 / ISP / SCRPTLST / MCD.CMD < prev    next >
Encoding:
Text File  |  1996-02-16  |  4.0 KB  |  193 lines

  1. #
  2. #      This is a dialing script designed to work with Mindemoya Computing
  3. #    
  4. #     It.is designed to work with Trumpet's Winsock, Version 2.0, Rev B.
  5. #
  6. #     If there are any problems, comments or suggestions, please e-mail
  7. #  'support@mcd.on.ca'.
  8. #
  9.  
  10. #
  11. # set up some strings for dialling up
  12. #
  13.  
  14. $modeminit = "atz"
  15. $userprompt = "login:"
  16. $passprompt = "assword:"
  17.  
  18. %numberlock = 0
  19. %errorlimit = 4
  20. %diallimit = 200
  21. %dialtimeout = 60
  22.  
  23. if ! [ load $modemsetup ]
  24.   if [ modemsetup "Enter Modem INIT string" ]
  25.     save $modemsetup
  26.   end
  27. end
  28.  
  29. if %ppp = 0
  30.    $slipcmd = "slip"
  31.  else
  32.    $slipcmd = "startppp"
  33.  end
  34.  
  35. #
  36. #      You can enter your userid and password using the 'setup' script via
  37. #  Trumpet Winsock (you'll find it under 'Other' scripts).  It will encrypt
  38. #  your password so that it won't be evident to someone snooping around
  39. #  your system, and will be properly loaded up here.
  40. #
  41.  
  42. if ! [ load $username ]
  43.   if [ username "Enter login id" ]
  44.     save $username
  45.   end
  46. end
  47.  
  48. if ![ load $password ]
  49.   if [ password "Password" ]
  50.     save $password
  51.   end
  52. end
  53.  
  54. if ! [ load $number ]
  55.   $number = $number1
  56.   %numberlock = 0
  57.  else
  58.   %numberlock = 1
  59. end
  60.  
  61. #
  62. #
  63. # initialize modem
  64. #
  65. %errors = 0
  66. %ok = 0
  67.  
  68. display "** Initializing modem **"\n
  69. repeat
  70.   outputecho $modeminit\13
  71.   if [expect 10 "OK"]
  72.     %ok = 1
  73.    else
  74.     %errors = %errors + 1
  75.     display "** Modem is not responding!  Attempt "%errors"/"%errorlimit". **"\n
  76.     if %errors = %errorlimit
  77.       abort
  78.     end
  79.     output "+++"
  80.     wait 4
  81.   end
  82. until %ok = 1
  83.  
  84. display \n
  85. # output "atm"\13
  86. # if ! [input 10 OK\n]
  87. #   display "Modem is not responding"\n
  88. #  abort
  89. # end
  90. # output "at"$modemsetup\13
  91. output $modemsetup\13
  92. if ! [input 10 OK\n]
  93.   display "Modem is not responding"\n
  94.   abort
  95.  end
  96. # output "at"$modemsetup\13
  97. # output $modemsetup\13
  98.  
  99. # input 10 OK\n
  100. #
  101. # send phone number
  102. #
  103. %dials = 0
  104. %ok = 0
  105. %errors = 0
  106. repeat
  107.   if %dials = %diallimit
  108.     display "** Dialing attempt limit of "%diallimit" reached **"\n
  109.     display "** Increase limit in script or try later... **"\n
  110.     abort
  111.   end
  112.   %dials = %dials + 1
  113.   display "** Dialing at "$number".  Attempt "%dials"/"%diallimit" **"\n
  114.   if [outputecho 60 "atdt"$number\13]
  115.     if ! [read 10 $talkback]
  116.       %errors = %errors + 1
  117.       display "** Connection timeout error "%errors"/"%errorlimit"."\n
  118.       if %errors = %errorlimit
  119.         display "** Error limit reached.  Aborting... **"\n
  120.         abort
  121.       end
  122.      else
  123.       if copy( $talkback, 1, 7 ) = "CONNECT"
  124.         %ok = 1
  125.        else
  126.         if $talkback = "BUSY"
  127.           display "** Busy detected.  Attempt "%dials"/"%diallimit". **"\n
  128.          else
  129.           if $talkback = "NO CARRIER"
  130.             display "** Ring-through detected.  Attempt "%dials"/"%diallimit".**"\n
  131.             if %numberlock = 0
  132.               if $number = $number1
  133.                 display "** Switching dial number from "$number" to "$number2".**"\n
  134.                 $number = $number2
  135.                else
  136.                 display "** Switching dial number from "$number" to "$number1".**"\n
  137.                 $number = $number1
  138.               end
  139.             end
  140.           end
  141.         end
  142.         display "** Redialing... **"\n
  143.       end
  144.     end
  145.    else
  146.     %errors = %errors + 1
  147.     display "** Dialing timeout error "%errors"/"%errorlimit"."\n
  148.     if %errors = %errorlimit
  149.       display "** Error limit reached.  Aborting... **"\n
  150.       abort
  151.     end
  152.   end
  153. until %ok
  154.  
  155. input 60 \n
  156.  
  157.  wait 60 dcd
  158. #
  159. #  wait for the username prompt
  160. #
  161. while ![input 5 $userprompt]
  162.     output \n
  163. end
  164. output $username\13
  165.  
  166.  
  167.  
  168. #input 30 $userprompt
  169. #output $username\13
  170. #
  171. # and the password
  172. #
  173. input 30 $passprompt
  174. output $password\13
  175. #
  176. if [input 60 "%"]
  177.    output $slipcmd\13
  178.    address 30
  179.    # input 60 \n
  180.    display \n"** Connection confirmed, IP address: "\i" **"\n
  181.    online
  182. else
  183.    display \n"** Connection not confirmed! Aborting... **"\n
  184.    abort
  185. end
  186. #
  187. #
  188. # now we are finished.
  189. #
  190.  
  191.  
  192.  
  193.